<script setup lang="ts">
  // @ts-nocheck
  import { useAppStore } from '@/store/app';
  import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';

  const appStore = useAppStore();

  // 初始化系统信息
  const initSystemInfo = function () {
    uni.getSystemInfo({
      success(res) {
        // #ifndef MP
        appStore.StatusBar = res.statusBarHeight;
        if (res.platform === 'android') {
          appStore.CustomBar = res.statusBarHeight + 50;
        } else {
          appStore.CustomBar = res.statusBarHeight + 43;
        }
        // #endif
        
        // #ifdef MP-WEIXIN
        appStore.StatusBar = res.statusBarHeight;
        const custom = wx.getMenuButtonBoundingClientRect();
        appStore.Custom = custom;
        appStore.CustomBar = custom.top - res.statusBarHeight;
        // #endif
      },
    });
  };

  const initData = function () {
    // 获取系统title高度
    initSystemInfo();
  };

  initData();

  onLaunch(() => {
    console.log('App Launch');
  });

  onShow(() => {
    console.log('App Show');
  });

  onHide(() => {
    console.log('App Hide');
  });
</script>

<style lang="scss">
  /*#ifndef MP*/
  @import url('https://at.alicdn.com/t/font_1681579_dwilkcq6mvg.css');
  /*#endif*/

  page,
  view,
  scroll-view,
  swiper,
  swiper-item,
  cover-view,
  cover-image,
  icon,
  text,
  rich-text,
  progress,
  button,
  checkbox,
  form,
  input,
  label,
  radio,
  slider,
  switch,
  textarea,
  navigator,
  audio,
  camera,
  image,
  video {
    box-sizing: border-box;
  }

  page {
    width: 100vw;
    min-height: 100vh;
    background-color: #f9f9f9;
  }
</style>
